<template>
  <Card class="card_box">
    <div class="card" style="text-align:center" @click="card_jump_click(crad_data.url)">
      <h1>{{crad_data.desc}}</h1>
      <div class="tag">
        <Tag color="blue">
          <Time :time="crad_data.publishedAt" />
        </Tag>
        <Tag color="gold">作者：{{crad_data.who}}</Tag>
        <Tag color="green">{{crad_data.type}}</Tag>
      </div>
      <div class="images_list">
        <img
          v-for="(item,index) in crad_data.images"
          :key="index"
          :src="'https://images.weserv.nl/?url='+item"
          alt
        />
      </div>
    </div>
  </Card>
</template>
<script>
import { mapState, mapActions, mapMutations } from "vuex";
export default {
  props: ["crad_data"],
  data() {
    return {};
  },
  computed: {
    ...mapState("index", ["index_data"])
  },
  methods: {
    card_jump_click(url) {
      // H5 plus事件处理
      function plusReady() {
        create();
      }
      if (window.plus) {
        plusReady();
      } else {
        document.addEventListener("plusready", plusReady, false);
        top.location.href = url;
      }

      // 创建并显示新窗口
      function create() {
        var w = plus.webview.create(url, url, {
          backButtonAutoControl: "close"
        });
        w.show(); // 显示窗口
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.card_box {
  margin: 0.4rem;
}
.card {
  overflow: hidden;
  h1 {
    font-size: 0.4rem;
  }
  .tag {
    padding: 0.4rem 0;
  }
  .images_list {
    overflow: hidden;
    img {
      float: left;
      width: 50%;
      padding: 0.2rem;
      margin: auto;
    }
  }
}
</style>
